package com.zk.lib_service.activity

import android.content.Context
import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.zk.lib_service.R
import com.zk.lib_service.ServiceManager

/**
 * 播放器全屏view
 */
class ServiceStudyActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_service_study)
        findViewById<Button>(R.id.bt_watch_service).setOnClickListener {
            ServiceManager.getRunServiceInfos(this)
        }

        findViewById<Button>(R.id.bt_start_service).setOnClickListener {
            ServiceManager.startService(this)
        }
        findViewById<Button>(R.id.bt_close_service).setOnClickListener {
            ServiceManager.stopService(this)
        }

        findViewById<Button>(R.id.bt_start_service2).setOnClickListener {
            ServiceManager.startService2(this)
        }
        findViewById<Button>(R.id.bt_close_service2).setOnClickListener {
            ServiceManager.stopService2(this)
        }
        findViewById<Button>(R.id.bt_background_startservice).setOnClickListener {
            ServiceManager.startServiceOnBackgroud(this)
        }

        findViewById<Button>(R.id.bt_start_foreservice).setOnClickListener {
            ServiceManager.startForeService(this)
        }
        findViewById<Button>(R.id.bt_close_foreservice).setOnClickListener {
            ServiceManager.stopForeService(this)
        }
        findViewById<Button>(R.id.bt_start_foreservice2).setOnClickListener {
            ServiceManager.startForeService2(this)
        }
        var context:Context?=null
        findViewById<Button>(R.id.bt_bind_service).setOnClickListener {
            context= ServiceManager.startBindService(this)
        }
        findViewById<Button>(R.id.bt_unbind_service).setOnClickListener {
            ServiceManager.stopUnBindService(context!!)
        }

        findViewById<Button>(R.id.bt_bind_foreservice).setOnClickListener {
            context= ServiceManager.startForeBindService(this)
        }

        findViewById<Button>(R.id.bt_startbind_service).setOnClickListener {
            context= ServiceManager.startAndForeBindService(this)
        }
        findViewById<Button>(R.id.bt_stopbind_service).setOnClickListener {
            ServiceManager.stopAndForeBindService(this)
        }






    }
}